package com.itjiange.service.user.controller.inner;

import com.itjiange.model.entity.User;
import com.itjiange.model.vo.UserVO;
import com.itjiange.service.client.UserFeignClient;
import com.itjiange.service.user.service.UserService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;

/**
 * @author ItJianGe
 * @data 2024/4/8 11:05
 */
@RequestMapping("/inner")
@RestController
public class UserInnerController implements UserFeignClient {

    @Resource
    private UserService userService;

    @Override
    @GetMapping("/get/{id}")
    public User getById(@PathVariable("id") long userId) {
        return userService.getById(userId);
    }

    @Override
    @PostMapping("/get/user")
    public UserVO getUserVO(@RequestBody User user) {
        return userService.getUserVO(user);
    }

    @Override
    @PostMapping("/get/users")
    public List<User> listByIds(@RequestBody Collection<Long> userIdSet) {
        return userService.listByIds(userIdSet);
    }
}
